Release 10.1A: OpenEdge Development:
Progress 4GL Reference
TRIM function
Removes leading and trailing white space, or other specified characters, from a CHARACTER or LONGCHAR expression.
Syntax
expressionAn expression (a constant, field name, variable name, or expression) whose value is a CHARACTER or LONGCHAR. If
expressionis a case-sensitive variable, Progress performs a case-sensitive trim. Ifexpressionis a LONGCHAR, the result is in the same code page.trim-charsA character expression that specifies the characters to trim from
Examplesexpression. If you do not specifytrim-chars, the TRIM function removes spaces, tabs, line feeds, and carriage returns.The following procedure displays a menu that you can use to display customer and order information. The option numbers are displayed with leading spaces. The TRIM function removes the leading white space so the menu selection can be easily evaluated.
The following example reads a text file and breaks it into words. It assumes that all words are separated by at least one space character. It uses the TRIM function with one parameter to remove white space from the ends of each input line. It then uses the TRIM function with two parameters to remove any punctuation characters from each word.
Notes
- The TRIM function is double-byte enabled. The specified
expressionandtrim-charsarguments can contain double-byte characters. TRIM does not remove double-byte space characters by default.- A character string displays with the default format of x(8), unless you specify a format or use a statement such as DISPLAY @
literal.- You can use the DEBLANK option of the Format phrase to remove leading spaces for fields in the input buffer.
- If
expressionis a case-sensitive field or variable, thentrim-charsis also case sensitive. Otherwise,trim-charsis not case sensitive.See also
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |